package com.example.hp.ormapp.adapter;

import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;

import com.allen.library.SuperTextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.hp.ormapp.bean.CrmBean;
import com.rongsheng.ormapp.R;

import java.util.List;

/**
 * Created by hang on 2018/4/26 0026.
 */

public class CrmAdapter extends BaseQuickAdapter<CrmBean.RowsBean, BaseViewHolder> {
    public CrmAdapter(@LayoutRes int layoutResId, @Nullable List<CrmBean.RowsBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CrmBean.RowsBean item) {
        switch (helper.getLayoutPosition() % 2) {
            case 0:
                ((SuperTextView) helper.getView(R.id.item_info)).setBackgroundResource(R.color.white);
                break;
            case 1:
                ((SuperTextView) helper.getView(R.id.item_info)).setBackgroundResource(R.color.gray_e3);
                break;
        }
        ((SuperTextView) helper.getView(R.id.item_info)).setLeftTopString(item.getFront()).setLeftBottomString(item.getSeries()).setRightString(item.getCreationTime()).setClickable(false);
    }
}
